﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;


namespace CoreModule.Converters
{
    /// <summary>
    /// 血糖状态 对应显示
    /// </summary>
    public class BloodGlucoseStatusToVisibilityConverter : IValueConverter
    {
        /// <summary>
        /// 血糖状态，等于则显示。
        /// </summary>

        public BloodGlucoseStatus VisibilityValue { get; set; } = BloodGlucoseStatus.None;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {

            var bloodGlucoseStatus = (BloodGlucoseStatus)value;
            if (bloodGlucoseStatus == VisibilityValue)
            {
                return Visibility.Visible;
            }
            else
            {
                return Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
